import Http from '@/http';

export function pageApi(params) {
    return Http.post('ota/firmware/page', params)
}

export function saveApi(params:any) {
    return params.id ? Http.put('ota/update/firmware/' + params.id, params) : Http.post('ota/add/firmware', params)
}

export function deleteApi(id) {
    return Http.delete('ota/delete/firmware/' + id)
}

export function uploadFirmwareApi(file:File) {
    const formData = new FormData()
    formData.append('firmware', file)
    return Http.post('ota/upload/firmware', formData)
}


export function upgradeApi(data) {
    return Http.post('ota/upgrade', data)
}

export function upgradePageApi(data) {
    return Http.post('ota/upgrade/page', data)
}

export function devicePageApi(data) {
    return Http.post('ota/upgrade/device/page', data)
}